package com.demo.jdkproxy;

import org.apache.log4j.Logger;

import java.lang.reflect.Method;

/**
 * Created by chenhe17596 on 2017/6/24.
 * 汽车行驶日志代理，用来记录日志，同时继承自汽车时间代理类，调用父类方法，实现汽车行驶时间代理
 */
public class CarLogProcy extends CarTimeProxy {

    Object object;

    public CarLogProcy(Object object){
        super(object);
        this.object=object;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("开始记录日志....");
        Object obj = super.invoke(proxy,method,args);
        System.out.println("结束记录日志....");

        return obj;
    }
}
